<?php
/**
 * Created by PhpStorm.
 * User: hebidu
 * Date: 15/12/15
 * Time: 09:28
 */

namespace Shop\Api;


use Common\Api\Api;
use Shop\Model\InviteRankingModel;

class InviteRankingApi  extends Api{

    /**
     * 获取排名
     */
    const GET_RANKING = "Shop/InviteRanking/getRanking";

    public function _init(){
        $this->model = new InviteRankingModel();
    }


    public function getRanking($num=10){

        $result = $this->model->alias("rank")->join("LEFT JOIN common_member as member on member.uid = rank.invite_id")
                ->field("rank.invite_id,rank.cnt,member.nickname , member.realname")->limit("0,".$num)->select();

        return $this->apiReturnSuc($result);
    }

}